package rps.client.ui;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Random;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;

import rps.game.data.Figure;
import rps.game.data.FigureKind;

public class GameLogic {
	private int nRock     = 0;
	private int nPaper    = 0;
	private int nScissor  = 0;
	private int nFlag	  = 0;
	private int nTrap	  = 0;
	private int nFree     = 0;
	private int gameState = 0;
	
	public int getGameState() {
		return gameState;
	}

	public void setGameState(int gameState) {
		this.gameState = gameState;
	}
	
	public static ArrayList<Integer> returnRandomArray () {
		ArrayList<Integer> ret = new ArrayList<Integer>();
		
		for (int i = 28; i <= 41; i++) {
			ret.add(i);
		}
		
		Collections.shuffle(ret);
		return ret;
	}
	
	/**private void countKinds (JLabel[] array) {		
		nRock     = 0;
		nPaper    = 0;
		nScissor  = 0;
		nFlag	  = 0;
		nTrap	  = 0;
		nFree     = 0;

		for (int j =28 ; j<42;j++){
			
			if (isGrass(array[j])) {
				nFree++;
			} else if(isScissor(array[j])) {
				nScissor ++;
			} else if(isRock(array[j])) {
				nRock ++;
			} else if(isPaper(array[j])) {
				nPaper ++;
			} else if(isFlag(array[j])) {
				nFlag ++;
			} else if(isTrap(array[j])) {
				nTrap ++;
			}
		}
	}**/
	
	public Figure[] invertTable (Figure[] assignment) {
		Figure[] temp = new Figure [assignment.length];
		for (int i = 0; i < 42 ; i++) {
			temp[i] = assignment[41-i];
		}
		return temp;
	}
}
